package com.bjc.principle.flyweight;

/**
 * @program: DesignPattern
 * @description:
 * @author: bjc
 * @create: 2021-01-04 16:42
 */
public class MoBikeFlyWeight extends BikeFlyWeight {

    //定义新的内部状态,车架号
    private String bikeId;

    public MoBikeFlyWeight(String bikeId) {
        this.bikeId = bikeId;
    }

    @Override
    void ride(String userName) {
        state = 1;
        System.out.println("----"+bikeId);
        System.out.println(userName+"骑"+bikeId+"号 自行车出行！");
    }

    @Override
    void back() {
        state = 0;
    }
}
